package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbOilCount;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbOilCountMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbOilCount> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbOilCountResult")
    TbOilCount selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbOilCountResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="plate_num", property="plateNum", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="organ_id", property="organId", jdbcType=JdbcType.BIGINT),
        @Result(column="all_oil", property="allOil", jdbcType=JdbcType.REAL),
        @Result(column="empty_oil", property="emptyOil", jdbcType=JdbcType.REAL),
        @Result(column="work_oil", property="workOil", jdbcType=JdbcType.REAL),
        @Result(column="exception_oil", property="exceptionOil", jdbcType=JdbcType.REAL),
        @Result(column="add_oil", property="addOil", jdbcType=JdbcType.REAL),
        @Result(column="all_distance", property="allDistance", jdbcType=JdbcType.REAL),
        @Result(column="empty_distance", property="emptyDistance", jdbcType=JdbcType.REAL),
        @Result(column="work_distance", property="workDistance", jdbcType=JdbcType.REAL),
        @Result(column="exception_distance", property="exceptionDistance", jdbcType=JdbcType.REAL),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TbOilCount> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbOilCountDynamicSqlSupport.tbOilCount);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbOilCountDynamicSqlSupport.tbOilCount);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbOilCountDynamicSqlSupport.tbOilCount)
                .where(TbOilCountDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbOilCount record) {
        return insert(SqlBuilder.insert(record)
                .into(TbOilCountDynamicSqlSupport.tbOilCount)
                .map(TbOilCountDynamicSqlSupport.plateNum).toProperty("plateNum")
                .map(TbOilCountDynamicSqlSupport.type).toProperty("type")
                .map(TbOilCountDynamicSqlSupport.organId).toProperty("organId")
                .map(TbOilCountDynamicSqlSupport.allOil).toProperty("allOil")
                .map(TbOilCountDynamicSqlSupport.emptyOil).toProperty("emptyOil")
                .map(TbOilCountDynamicSqlSupport.workOil).toProperty("workOil")
                .map(TbOilCountDynamicSqlSupport.exceptionOil).toProperty("exceptionOil")
                .map(TbOilCountDynamicSqlSupport.addOil).toProperty("addOil")
                .map(TbOilCountDynamicSqlSupport.allDistance).toProperty("allDistance")
                .map(TbOilCountDynamicSqlSupport.emptyDistance).toProperty("emptyDistance")
                .map(TbOilCountDynamicSqlSupport.workDistance).toProperty("workDistance")
                .map(TbOilCountDynamicSqlSupport.exceptionDistance).toProperty("exceptionDistance")
                .map(TbOilCountDynamicSqlSupport.inputTime).toProperty("inputTime")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbOilCount record) {
        return insert(SqlBuilder.insert(record)
                .into(TbOilCountDynamicSqlSupport.tbOilCount)
                .map(TbOilCountDynamicSqlSupport.plateNum).toPropertyWhenPresent("plateNum", record::getPlateNum)
                .map(TbOilCountDynamicSqlSupport.type).toPropertyWhenPresent("type", record::getType)
                .map(TbOilCountDynamicSqlSupport.organId).toPropertyWhenPresent("organId", record::getOrganId)
                .map(TbOilCountDynamicSqlSupport.allOil).toPropertyWhenPresent("allOil", record::getAllOil)
                .map(TbOilCountDynamicSqlSupport.emptyOil).toPropertyWhenPresent("emptyOil", record::getEmptyOil)
                .map(TbOilCountDynamicSqlSupport.workOil).toPropertyWhenPresent("workOil", record::getWorkOil)
                .map(TbOilCountDynamicSqlSupport.exceptionOil).toPropertyWhenPresent("exceptionOil", record::getExceptionOil)
                .map(TbOilCountDynamicSqlSupport.addOil).toPropertyWhenPresent("addOil", record::getAddOil)
                .map(TbOilCountDynamicSqlSupport.allDistance).toPropertyWhenPresent("allDistance", record::getAllDistance)
                .map(TbOilCountDynamicSqlSupport.emptyDistance).toPropertyWhenPresent("emptyDistance", record::getEmptyDistance)
                .map(TbOilCountDynamicSqlSupport.workDistance).toPropertyWhenPresent("workDistance", record::getWorkDistance)
                .map(TbOilCountDynamicSqlSupport.exceptionDistance).toPropertyWhenPresent("exceptionDistance", record::getExceptionDistance)
                .map(TbOilCountDynamicSqlSupport.inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbOilCount>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbOilCountDynamicSqlSupport.id, TbOilCountDynamicSqlSupport.plateNum, TbOilCountDynamicSqlSupport.type, TbOilCountDynamicSqlSupport.organId, TbOilCountDynamicSqlSupport.allOil, TbOilCountDynamicSqlSupport.emptyOil, TbOilCountDynamicSqlSupport.workOil, TbOilCountDynamicSqlSupport.exceptionOil, TbOilCountDynamicSqlSupport.addOil, TbOilCountDynamicSqlSupport.allDistance, TbOilCountDynamicSqlSupport.emptyDistance, TbOilCountDynamicSqlSupport.workDistance, TbOilCountDynamicSqlSupport.exceptionDistance, TbOilCountDynamicSqlSupport.inputTime)
                .from(TbOilCountDynamicSqlSupport.tbOilCount);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbOilCount>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbOilCountDynamicSqlSupport.id, TbOilCountDynamicSqlSupport.plateNum, TbOilCountDynamicSqlSupport.type, TbOilCountDynamicSqlSupport.organId, TbOilCountDynamicSqlSupport.allOil, TbOilCountDynamicSqlSupport.emptyOil, TbOilCountDynamicSqlSupport.workOil, TbOilCountDynamicSqlSupport.exceptionOil, TbOilCountDynamicSqlSupport.addOil, TbOilCountDynamicSqlSupport.allDistance, TbOilCountDynamicSqlSupport.emptyDistance, TbOilCountDynamicSqlSupport.workDistance, TbOilCountDynamicSqlSupport.exceptionDistance, TbOilCountDynamicSqlSupport.inputTime)
                .from(TbOilCountDynamicSqlSupport.tbOilCount);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbOilCount selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbOilCountDynamicSqlSupport.id, TbOilCountDynamicSqlSupport.plateNum, TbOilCountDynamicSqlSupport.type, TbOilCountDynamicSqlSupport.organId, TbOilCountDynamicSqlSupport.allOil, TbOilCountDynamicSqlSupport.emptyOil, TbOilCountDynamicSqlSupport.workOil, TbOilCountDynamicSqlSupport.exceptionOil, TbOilCountDynamicSqlSupport.addOil, TbOilCountDynamicSqlSupport.allDistance, TbOilCountDynamicSqlSupport.emptyDistance, TbOilCountDynamicSqlSupport.workDistance, TbOilCountDynamicSqlSupport.exceptionDistance, TbOilCountDynamicSqlSupport.inputTime)
                .from(TbOilCountDynamicSqlSupport.tbOilCount)
                .where(TbOilCountDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbOilCount record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilCountDynamicSqlSupport.tbOilCount)
                .set(TbOilCountDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbOilCountDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbOilCountDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbOilCountDynamicSqlSupport.allOil).equalTo(record::getAllOil)
                .set(TbOilCountDynamicSqlSupport.emptyOil).equalTo(record::getEmptyOil)
                .set(TbOilCountDynamicSqlSupport.workOil).equalTo(record::getWorkOil)
                .set(TbOilCountDynamicSqlSupport.exceptionOil).equalTo(record::getExceptionOil)
                .set(TbOilCountDynamicSqlSupport.addOil).equalTo(record::getAddOil)
                .set(TbOilCountDynamicSqlSupport.allDistance).equalTo(record::getAllDistance)
                .set(TbOilCountDynamicSqlSupport.emptyDistance).equalTo(record::getEmptyDistance)
                .set(TbOilCountDynamicSqlSupport.workDistance).equalTo(record::getWorkDistance)
                .set(TbOilCountDynamicSqlSupport.exceptionDistance).equalTo(record::getExceptionDistance)
                .set(TbOilCountDynamicSqlSupport.inputTime).equalTo(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbOilCount record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilCountDynamicSqlSupport.tbOilCount)
                .set(TbOilCountDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbOilCountDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbOilCountDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbOilCountDynamicSqlSupport.allOil).equalToWhenPresent(record::getAllOil)
                .set(TbOilCountDynamicSqlSupport.emptyOil).equalToWhenPresent(record::getEmptyOil)
                .set(TbOilCountDynamicSqlSupport.workOil).equalToWhenPresent(record::getWorkOil)
                .set(TbOilCountDynamicSqlSupport.exceptionOil).equalToWhenPresent(record::getExceptionOil)
                .set(TbOilCountDynamicSqlSupport.addOil).equalToWhenPresent(record::getAddOil)
                .set(TbOilCountDynamicSqlSupport.allDistance).equalToWhenPresent(record::getAllDistance)
                .set(TbOilCountDynamicSqlSupport.emptyDistance).equalToWhenPresent(record::getEmptyDistance)
                .set(TbOilCountDynamicSqlSupport.workDistance).equalToWhenPresent(record::getWorkDistance)
                .set(TbOilCountDynamicSqlSupport.exceptionDistance).equalToWhenPresent(record::getExceptionDistance)
                .set(TbOilCountDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbOilCount record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilCountDynamicSqlSupport.tbOilCount)
                .set(TbOilCountDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbOilCountDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbOilCountDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbOilCountDynamicSqlSupport.allOil).equalTo(record::getAllOil)
                .set(TbOilCountDynamicSqlSupport.emptyOil).equalTo(record::getEmptyOil)
                .set(TbOilCountDynamicSqlSupport.workOil).equalTo(record::getWorkOil)
                .set(TbOilCountDynamicSqlSupport.exceptionOil).equalTo(record::getExceptionOil)
                .set(TbOilCountDynamicSqlSupport.addOil).equalTo(record::getAddOil)
                .set(TbOilCountDynamicSqlSupport.allDistance).equalTo(record::getAllDistance)
                .set(TbOilCountDynamicSqlSupport.emptyDistance).equalTo(record::getEmptyDistance)
                .set(TbOilCountDynamicSqlSupport.workDistance).equalTo(record::getWorkDistance)
                .set(TbOilCountDynamicSqlSupport.exceptionDistance).equalTo(record::getExceptionDistance)
                .set(TbOilCountDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .where(TbOilCountDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbOilCount record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilCountDynamicSqlSupport.tbOilCount)
                .set(TbOilCountDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbOilCountDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbOilCountDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbOilCountDynamicSqlSupport.allOil).equalToWhenPresent(record::getAllOil)
                .set(TbOilCountDynamicSqlSupport.emptyOil).equalToWhenPresent(record::getEmptyOil)
                .set(TbOilCountDynamicSqlSupport.workOil).equalToWhenPresent(record::getWorkOil)
                .set(TbOilCountDynamicSqlSupport.exceptionOil).equalToWhenPresent(record::getExceptionOil)
                .set(TbOilCountDynamicSqlSupport.addOil).equalToWhenPresent(record::getAddOil)
                .set(TbOilCountDynamicSqlSupport.allDistance).equalToWhenPresent(record::getAllDistance)
                .set(TbOilCountDynamicSqlSupport.emptyDistance).equalToWhenPresent(record::getEmptyDistance)
                .set(TbOilCountDynamicSqlSupport.workDistance).equalToWhenPresent(record::getWorkDistance)
                .set(TbOilCountDynamicSqlSupport.exceptionDistance).equalToWhenPresent(record::getExceptionDistance)
                .set(TbOilCountDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .where(TbOilCountDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}